local chongjian = fk.CreateSkill({
  name = "cao__chongjian",
})

chongjian:addEffect("active", {
  anim_type = "offensive",
  card_num = 0,
  target_num = 1,
  prompt = "冲坚：与一名其他角色各重铸两张牌",
  can_use = function(self, player)
    return player:usedSkillTimes(chongjian.name, Player.HistoryPhase) < (1 + player:getMark("cao__chongjian-turn"))
  end,
  times = function (self, player)
    return (1 + player:getMark("cao__chongjian-turn")) - player:usedSkillTimes(chongjian.name, Player.HistoryPhase)
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select ~= player and #to_select:getCardIds("he") > 1 and #player:getCardIds("he") > 1
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local card1= room:askToChooseCards(player, {
        target = player,
        min = 2,
        max = 2,
        flag = "he",
        skill_name = chongjian.name
        })
    room:recastCard(card1, player, chongjian.name)
    local card2= room:askToChooseCards(target, {
        target = target,
        min = 2,
        max = 2,
        flag = "he",
        skill_name = chongjian.name
        })
    room:recastCard(card2, target, chongjian.name)
    if  #table.filter(card1, function(id)
        return Fk:getCardById(id).trueName == "slash"
        end) > 0
      then
        if  #table.filter(card2, function(id)
            return Fk:getCardById(id).trueName == "slash"
            end) > 0
          then
            if player:usedSkillTimes(chongjian.name, Player.HistoryPhase) == 1 then
                room:setPlayerMark(player, "cao__chongjian-turn", 1)
            end
            for _, id in ipairs(card1) do
                local card = Fk:getCardById(id)
                if (card.trueName == "slash" )then
                    room:askToUseRealCard(player, {
                        pattern = { id },
                        skill_name = chongjian.name,
                        extra_data = {
                        bypass_times = true,
                        bypass_distances = true,
                        expand_pile = { id },
                        extraUse = true,
                        },
                    })
                end
            end
        else
            for _, id in ipairs(card1) do
                local card = Fk:getCardById(id)
                if (card.trueName == "slash" )then
                    room:askToUseRealCard(player, {
                        pattern = { id },
                        skill_name = chongjian.name,
                        extra_data = {
                        bypass_times = true,
                        expand_pile = { id },
                        extraUse = true,
                        },
                    })
                end
            end
        end
    end
  end,
})

Fk:loadTranslationTable{
  ["cao__chongjian"] = "冲坚",
  [":cao__chongjian"] = "出牌阶段限一次，你可以与一名其他角色各重铸两张牌，若你/其重铸的牌中包含【杀】，你可以依次使用之/你以此法使用的牌无距离限制且此技能本回合改为“出牌阶段限两次”。",
  ["$cao__chongjian1"] = "敌营寨未成，左右击之，可全胜也。",
  ["$cao__chongjian2"] = "以我观之，敌阵不堪一击。",
  ["#ask__chongjian1"] = "",
}



return chongjian

